package com.hsy.baoinbao.modules.order.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.deparse.dpframe.ui.adapter.DPBaseAdapter;
import com.hsy.baoinbao.R;
import com.hsy.baoinbao.modules.notice.gsondata.NoticeListData;

import java.util.HashMap;
import java.util.List;

/**
 * Created by MartinDKent on 2016/3/23.
 */
public class GoodsAdapter extends DPBaseAdapter<HashMap<String, String>> {
    private LayoutInflater inflater;

    public GoodsAdapter(Context context) {
        super();
        init(context);
    }

    public GoodsAdapter(Context context, List<HashMap<String, String>> data) {
        super(data);
        init(context);
    }

    private void init(Context context) {
        this.inflater = LayoutInflater.from(context);
    }

    @Override
    public CommonBaseViewHolder<HashMap<String, String>> getHolder(int position) {
        return new ViewHolder();
    }

    class ViewHolder extends CommonBaseViewHolder<HashMap<String, String>> {
        private TextView item_goods_title;

        @Override
        public View create(int position) {
            View view = inflater.inflate(R.layout.item_goods_list, null);
            item_goods_title = (TextView) view.findViewById(R.id.item_goods_title);

            return view;
        }

        @Override
        public void update(HashMap<String, String> data) {
            item_goods_title.setText(data.get("item_goods_title"));
        }

    }
}
